package com.webSite.demo.cy.bean;

import java.util.Date;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HtmlUtil;

/**
 * 公司新闻
* @ClassName: HomeNews  
* @author fengzihao  
* @date 2018年5月5日  
*
 */
public class HomeNews {

	private long id;
	private String title;
	private String content;
	private int state;
	private Date created;
    private Date updated;
    private String image;
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public Date getUpdated() {
		return updated;
	}
	public void setUpdated(Date updated) {
		this.updated = updated;
	}
	
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	
	public String getRealImageUrl() {
		return "http://fzh.oss-cn-beijing.aliyuncs.com/"+image;
	}
	/**
	 *  HtmlUtil.restoreEscaped 还原被转义的HTML特殊字符
	*	HtmlUtil.encode 转义文本中的HTML字符为安全的字符
	*	HtmlUtil.cleanHtmlTag 清除所有HTML标签
	*	HtmlUtil.removeHtmlTag 清除指定HTML标签和被标签包围的内容
	*	HtmlUtil.unwrapHtmlTag 清除指定HTML标签，不包括内容
	*	HtmlUtil.removeHtmlAttr 去除HTML标签中的属性
	*	HtmlUtil.removeAllHtmlAttr 去除指定标签的所有属性
	*	HtmlUtil.filter 过滤HTML文本，防止XSS攻击
	* @Title: getRemoveHtmlContent  
	* @param @return    参数  
	* @return String    返回类型  
	* @throws
	 */
	public String getRemoveHtmlContent() {
		return getRemoveHtmlContent(40);
	}
    
	public String getRemoveHtmlContent(int length) {
		return StrUtil.sub(HtmlUtil.cleanHtmlTag(content), 0, length);
	}
}
